package Encryption;
//
public class mainEncryption 
{
	public static void DHTest()
	{
		// Alice picks exp A
		int a_exp = 2;
		int a_public = DH.base_4.GetPublicKey(a_exp);
		
		System.out.println("A Public: " + a_public);
		
		// Bob picks B
		
		int b_exp = 3;
		int b_public = DH.base_4.GetPublicKey(b_exp);
		
		System.out.println("B Public: " + b_public);
		
		// ALice
		int a_shared_key = DH.GetSessionKey(a_exp, b_public);
		
		// Bob
		int b_shared_key = DH.GetSessionKey(b_exp, a_public);
		
		System.out.println(a_shared_key + " " + b_shared_key);
	}
	
	public static void AESTest() throws Exception
	{
		// Alice picks exp A
		int a_exp = 2;

		int a_public = DH.base_4.GetPublicKey(a_exp);
		
		// Send this to Bob
		byte[] encrypted = Aes.EncryptedThis("19221e2e@^#*@Y*D*QBD*&#.189.2.3", "Challenge To Bob", a_public, "abc");
				
		// Bob gets encrypted, and decrypts into plain text
		String plainText = Aes.Decrypt(encrypted);
		
		System.out.println(plainText);
	}
	
	public static void AESTestNoPad() throws Exception
	{
		// Alice picks exp A
		int a_exp = 2;

		int a_public = DH.base_4.GetPublicKey(a_exp);
		
		// Send this to Bob
		byte[] encrypted = Aes.EncryptedThis("169.208.94.2", "Ra", a_public, "abc");
		
		String encryptedS = new String(encrypted);
		
		String plainText = Aes.DecryptNoPadding(encryptedS);
		
		System.out.println();
		System.out.println("What Bob Sees: " + plainText);

	}
	
	public static void main (String[] args) throws Exception
	{	
		AESTest();
		//AESTestNoPad();
		
		//AESCBCTest
		
	}
}
